package com.cfx.exercise_41;

import java.util.Scanner;  

public class ShutDos {  
    private ShutDownTool sd = new ShutDownTool();  
    public void menu(){  
        System.out.println("*************************************");  
          System.out.println("关机助手：");  
          System.out.println("1. 设置关机时间");  
          System.out.println("2. 取消关机");  
          System.out.println("0. Exit.");  
          System.out.println("*************************************");  
    }  
      
    public void work(){  
        Scanner in = new Scanner(System.in);  
        boolean f=true;  
        while(f){  
            this.menu();  
            System.out.println("请选择操作：");  
            int c=in.nextInt();  
            switch(c)  
            {  
                case(1) : {  
                    System.out.println("请输入多久后关机：（s为单位）");  
                    int sec = in.nextInt();  
                    sd.shutDownS(sec);  
                    break;  
                }  
                //余额  
                case(2) : {  
                    sd.shutDownCancel();  
                    break;  
                }  
                //取款  
                case(0) : {  
                    System.out.println("退出");  
                    f = false;  
                    break;  
                }  
                  
                default:{  
                    System.out.println("请输入正确选项");  
                    break;  
                }  
            }  
        }  
    }  
      
    public static void main(String[] args) {  
        ShutDos ts = new ShutDos();  
        ts.work();  
    }  
  
}  
